Test Series - Data Structure

Test Number 97/115

Q: The case in which a key other than the desired one is kept at the identified location is called?
A. Hashing
B. Collision
C. Chaining
D. Open addressing
Solution: When some other value is placed at a specified location other than the desired key, it is said to be a collision.
Q: What data organization method is used in hash tables?
A. Stack
B. Array
C. Linked list
D. Queue
Solution: The data structure used to organize data for hash tables is linked list. It contains a data field and a pointer field.
Q: The task of generating alternative indices for a node is called?
A. Collision handling
B. Collision detection
C. Collision recovery
D. Closed hashing
Solution: Collision handling involves the process of formulating alternative indices for a key.
Q: Which of the following is not a collision resolution technique?
A. Separate chaining
B. Linear probing
C. Quadratic probing
D. Hashing
Solution: Hashing is a technique of placing data items in specific locations. Collision may occur in hashing but hashing is not a collision resolution technique.
Q: Hashing is the problem of finding an appropriate mapping of keys into addresses.
A. True
B. False
C. 
D. 
Solution: Hashing is a data structure which is used to locate data in a table based on a key value.
Q: In a hash table of size 10, where is element 7 placed?
A. 6
B. 7
C. 17
D. 16
Solution: The hash location is defined as hash(f)= key mod table_size.
7 mod 10 gives 7. It is placed in 7th position.
Q: What should be the load factor for separate chaining hashing?
A. 0.5
B. 1
C. 1.5
D. 2
Solution: For hashing using separate chaining method, the load factor should be maintained as 1. For open addressing method, it should not exceed 0.5.
Q: Which of the following operations are done in a hash table?
A. Insert only
B. Search only
C. Insert and search
D. Replace
Solution: Hash tables are used to implement Insert and Find operations in constant average time. This is the prime purpose of hashing.
Q: Which of the following is identical to that of a separate chaining hash node?
A. Linked list
B. Array
C. Stack
D. Queue
Solution: The hash node in separate chaining is similar to that of a linked list. The separate chaining hash table is an array of linked lists.
Q: Which of the following is the hashing function for separate chaining?
A. H(x)=(hash(x)+f(i)) mod table size
B. H(x)=hash(x)+i2 mod table size
C. H(x)=x mod table size
D. H(x)=x mod (table size * 2)
Solution: The hashing function for separate chaining is given by H(x)= key mod table size. H(x)=hash(x)+i2 mod table size defines quadratic probing.

You Have Score    /10